<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestBetterDropDown.aspx.cs" Inherits="BetterLibraryTests.TestBetterDropDown" %>
<%@ Register Assembly="BetterControls" Namespace="BetterControls" TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
            <asp:GridView 
            ID="GridView1" 
            runat="server" 
            AutoGenerateColumns="False" 
            DataKeyNames="au_id"
            DataSourceID="SqlDataSource2">
            <Columns>
                <asp:BoundField DataField="au_lname" HeaderText="au_lname" SortExpression="au_lname"  />
                <asp:BoundField DataField="au_fname" HeaderText="au_fname" SortExpression="au_fname" />
                <asp:TemplateField HeaderText="state" SortExpression="state">
                    <ItemTemplate>
                        <asp:BetterDropDown 
                            ID="DropDownList1" 
                            runat="server" 
                            SelectedValue='<%# Bind("State") %>'
                            DataTextField="State" 
                            DataValueField="State"        
                            DataSourceID="SqlDataSource1">
                        </asp:BetterDropDown>
                        </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    
        <asp:SqlDataSource 
            ID="SqlDataSource1" 
            runat="server" 
            ConnectionString="<%$ ConnectionStrings:pubsConnectionString %>"
            SelectCommand="select state, 'y' as v from states"></asp:SqlDataSource>
        <asp:SqlDataSource 
            ID="SqlDataSource2" 
            runat="server" 
            ConnectionString="<%$ ConnectionStrings:pubsConnectionString %>"
            SelectCommand="SELECT [au_id], [au_lname], [au_fname], [state] FROM [authors]">
        </asp:SqlDataSource>

    </div>
    </form>
</body>
</html>
